<template>
	<view class="">
		<clubItem v-for="(item,index) in data.list" :key="index" :item="item"></clubItem>
		<view class="no-data">
			<uv-load-more fontSize="12" v-if="data.isComplete" status="nomore" />
		</view>
	</view>
</template>

<script setup>
	import {
		onLoad,
		onReachBottom
	} from '@dcloudio/uni-app';
	import {
		ref
	} from "vue";
	import clubItem from "@/compoments/discover/clubItem.vue";
	import {
		gameList
	} from "../../../../requestApi/api.js";
	const data = ref({
		list: [],
		from: {
			"current": 1,
			"enterpriseId": '',
			"size": 10,
		},
		isLoading: false,
		isComplete: false,
	})
	onLoad((e) => {
		data.value.from.enterpriseId = e.id;
		getList();
	});
	const getList = () => {
		data.value.isLoading = true;
		gameList(data.value.from).then(res => {
			data.value.isLoading = false;
			data.value.list = data.value.list.concat(res.data.records);
			data.value.from.current++;
			data.value.isComplete = !res.data.records.length;
		})
	};
	onReachBottom(() => {
		!data.value.isLoading && !data.value.isComplete && getList();
	})
</script>

<style>
</style>